﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RPGServer.Contracts.Requests;
using RPGServer.Contracts.Updates;

namespace RPGServer
{
    public class RPGHandle
    {
        public void Process(RPGPlayer player, byte[] buffer, int length)
        {
            byte scenario = buffer[0];
            byte command = buffer[1];
            if (scenario == RPGNET_SCENARIO.INIT)
            {
                if (command == RPGNET_REQUEST.LOGIN)
                {
                    RequestLogin.Process(player, buffer, length);
                }
            }
            else if (scenario == RPGNET_SCENARIO.GAME)
            {
                if (command == RPGNET_REQUEST.SWITCH_MAP)
                {
                    RequestSwitchMap.Process(player, buffer, length);
                }
                else if (command == RPGNET_REQUEST.MOVE_OBJECT)
                {
                    RequestMoveObject.Process(player, buffer, length);
                }
                else if (command == RPGNET_REQUEST.GOLIMR)
                {
                    RequestGOLIMR.Process(player, buffer, length);
                }
                else if (command == RPGNET_REQUEST.FA)
                {
                    RequestFA.Process(player, buffer, length);
                }
            }
            else if (scenario == RPGNET_SCENARIO.CTS_UPDATE)
            {
                if (command == RPGNET_UPDATE.UOS)
                {
                    UpdateUOS.Process(player, buffer, length);
                }
            }
        }
    }
}
